/*
 * SubentityOT.java
 *
 * $Id: SubentityOT.java,v 1.2 2009-06-01 14:04:48 juancarlos Exp $
 */
package org.ceteca.explica.core.installer;

/**
 * ValueObject with the data of a subentity item. It holds
 * the subentity information for building the selection dialog
 * (EntityOT instance), plus the data of the parent entity for
 * returning the selected data.
 * <br/>
 * Responsibilities:
 * <ul>
 *  <li>Store the subentity data.</li>
 * </ul>
 * <br/>
 * @author Mario García García <mario@imagos.es>
 * Copyright (c) 2008 Fundación Centro Tecnolóxico da Carne
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <br/>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <br/>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
public class SubentityOT {
	/**
	 * Data of the subentity used for subentity selection dialog's construction.
	 */
	private EntityOT subentityData;
	/**
	 * Name of the parent entity field whose value (of subentity type) will be 
	 * selected from the subentity selection dialog.
	 */
	private String parentFieldId;
	/**
	 * Parent entity launcher that will manage the subentity selection events
	 * (update the selected value for the parent entity field).
	 */
	private EntityLauncher parentEntity;
	
	/**
	 * Default constructor.
	 * @param subentityData EntityOT,  subentity data.
	 * @param parentFieldId String, parent entity field name linked to the subentity.  
	 * @param parentEntity EntityLauncher, parent entity launcher.
	 */
	public SubentityOT(EntityOT subentityData, String parentFieldId, EntityLauncher parentEntity) {
		this.setSubentityData(subentityData);
		this.setParentEntity(parentEntity);
		this.setParentFieldId(parentFieldId);
	}
	/**
	 * Gets the parent entity launcher that will manage the events
	 * of the subentity selection process.
	 * @return EntityLauncher, parent entity launcher.
	 */
	public EntityLauncher getParentEntity() {
		return parentEntity;
	}
	/**
	 * Sets up the parent entity launcher that will manage the events
	 * of the subentity selection process.
	 * @param parentEntity EntityLauncher, parent entity launcher.
	 */
	public void setParentEntity(EntityLauncher parentEntity) {
		this.parentEntity = parentEntity;
	}
	
	/**
	 * Gets the parent entity field whose value is the selected subentity.
	 * @return String, parent entity field id.
	 */
	public String getParentFieldId() {
		return parentFieldId;
	}
	/**
	 * Sets up the parent entity field whose value is the selected subentity.
	 * @param parentFieldId String, parent entity field id.
	 */
	public void setParentFieldId(String parentFieldId) {
		this.parentFieldId = parentFieldId;
	}
	
	/**
	 * Gets the subentiy data.
	 * @return EntityOT, subentity data.
	 */
	public EntityOT getSubentityData() {
		return subentityData;
	}
	/**
	 * Sets up the subentity data.
	 * @param subentityData EntityOT, subentity data.
	 */
	public void setSubentityData(EntityOT subentityData) {
		this.subentityData = subentityData;
	}
	
	
	
	public SubentityOT() {
		super();

	}
	/**
	 * Returns tag Id assigned to CVS source file.
	 */
	public static String getRevision() {
		return "$Id: SubentityOT.java,v 1.2 2009-06-01 14:04:48 juancarlos Exp $";
	}
}
